package neuron;

import java.io.File;
import java.util.ArrayList;

import neuron.geometry.CoordSet;
import neuron.geometry.Transform;
import neuron.geometry.Vector3d;

public class Network extends ArrayList<Neuron> {
	
	/**
	 * Source file.
	 */
	private File file;
	private Layers layers; // cortex layers
	
	public Network() {
	}


	public void setFile(File file) {
		this.file = file;
	}

	public File getFile() {
		return file;
	}


	public Layers getLayers() {
		return layers;
	}


	public void setLayers(Layers layers) {
		this.layers = layers;
	}

	public NetworkStatistics statistics()
	{
		return new NetworkStatistics(this);
	}
	
	public void zeroMean()
	{
		// collect coordinates
		CoordSet cs = new CoordSet();
		for (Neuron n : this) cs.addAll(n.getAllCoordinates());
		Vector3d mean = cs.mean().negate();
		for (Neuron n : this) Transform.translateNeuron(n, mean);
	}
}
